package data

import (
	"httpadmin/go-attribute/application/constant"
	"httpadmin/go-attribute/application/util"
	"strings"
)

type IOSDeviceInfo struct {
	IDevice
	Common  CommonDeviceInfo
	Idfa    string
	IdfaMd5 string
}

func (data *IOSDeviceInfo) GetDeviceMarks() []string {
	res := data.Common.GetDeviceMarks()
	if tmp := GetIdFaMark(data.Idfa, data.IdfaMd5); tmp != "" {
		res = append(res, tmp)
	}
	return res
}

func GetIdFaMark(idFa, idFaMd5 string) string {
	if len(idFaMd5) == constant.MD5Len {
		return strings.ToLower(idFaMd5)
	}
	if idFa == "" {
		return ""
	}
	return util.Md5LowerCase(idFa)
}
